import {
  getCompanyID,
  getLevelFirst,
  getLevelZero,
  getUserDepID,
  getUserID,
} from '@/utils';

const getRemindManageTabSwitch = (permissions: Record<string, any>) => {
  const MyRemindManageTab = () => {
    if (permissions?.['/notifyController/ownCompanyID']) {
      return {
        ownCompanyID: getLevelZero(),
        params: 'ownCompanyID',
        ownType: null,
        queryType: 0,
      };
    } else if (permissions?.['/notifyController/ownDepartmentID']) {
      return {
        ownDepartmentID: getLevelFirst(),
        params: 'ownDepartmentID',
        ownType: null,
        queryType: 1,
      };
    } else if (permissions?.['/notifyController/ownerID']) {
      return {
        ownerID: getUserID(),
        params: 'ownerID',
        ownType: null,
        queryType: 2,
      };
    }
  };
  const RemindManageTabMy = () => {
    if (permissions?.['/notifyController/receiverID']) {
      return {
        receiverID: getUserID(),
        params: 'receiverID',
        ownType: null,
        queryType: 3,
      };
    }
  };
  return [
    {
      title: '我的提醒',
      key: 'MyRemind',
      visible:
        (permissions?.['/notifyController/ownCompanyID'] ||
          permissions?.['/notifyController/ownDepartmentID'] ||
          permissions?.['/notifyController/ownerID']) ??
        false,
      md: 2,
      sm: 24,
      params: MyRemindManageTab(),
    },
    {
      title: '提醒我的',
      key: 'RemindMy',
      visible: permissions?.['/notifyController/receiverID'] ?? false,
      md: 2,
      sm: 24,
      params: RemindManageTabMy(),
    },
  ];
};
export { getRemindManageTabSwitch };
